﻿//                       NOTICE
// 
// This software was produced for the U. S. Government
// under Contract No. FA8721-10-C-0001, and is
// subject to the Rights in Noncommercial Computer Software
// and Noncommercial Computer Software Documentation Clause
// (DFARS) 252.227-7014 (JUN 1995)
// 
// � 2010 The MITRE Corporation. All Rights Reserved. 

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Surface.Core;

namespace MXSE.MultiTouch.Gestures
{
    public class TouchGesture : BasicGesture
    {
        public bool CanTap
        {
            get;
            private set;
        }

        public override ComplexGesture Parent
        {
            get
            {
                return base.Parent;
            }
            set
            {
                if( value != null )
                    CanTap = false;
                base.Parent = value;
            }
        }

        public TouchGesture(ContactEventArgs cea)
        {
            CanTap = true;
            startTime = DateTime.Now;
            startPosition = new Vector2(cea.Contact.X, cea.Contact.Y);
            currentPosition = startPosition;
            Id = cea.Contact.Id;
        }

        public override bool Destroyed()
        {
            if (destroyed || (DateTime.Compare(DateTime.MinValue, endTime) != 0 && DateTime.Compare(DateTime.Now, endTime + DOUBLE_TAP_DELAY) > 0 ))
            {
                return true;
            }
            return false;
        }

    }
}
